<!-- php:$title = "修改手机号 - 会员中心" --><!-- include tpl=head title=$title -->
<script type="text/javascript">
$(document).ready(function(){
	$("#userinfo_mobile").submit(function(){
		$(this).ajaxSubmit({
			'type':'post',
			'dataType':'json',
			'url':api_url('usercp','mobile'),
			'success':function(rs){
				if(rs.status){
					$.dialog.alert("您的手机更新成功",function(){
						$.phpok.reload();
					},'succeed');
					return true;
				}
				$.dialog.alert(rs.info);
				return false;
			}
		});
		return false;
	});
});
</script>
<!-- if $sendsms -->
<script type="text/javascript">
var maxtime = 60;
var sms_send_lock = false;
var win_time_out;
function update_send_sms_loading()
{
	maxtime--;
	if(maxtime < 1){
		$("#sms_send_status").val('发送验证码');
		sms_send_lock = false;
		maxtime = 60;
		window.clearInterval(win_time_out);
		return true;
	}
	var tips = "验证码已发送("+maxtime+")";
	$("#sms_send_status").val(tips);
}

function send_sms()
{
	if(sms_send_lock){
		$.dialog.alert('验证码已发送，请一分钟后再执行');
		return false;
	}
	var url = api_url('vcode','sms');
	var mobile = $("#mobile").val();
	if(!mobile){
		$.dialog.alert('手机号不能为空');
		return false;
	}
	url += "&mobile="+mobile;
	$.dialog.tips("正在执行中，请稍候…");
	update_send_sms_loading();
	$.phpok.json(url,function(rs){
		if(rs.status){
			maxtime = 60;
			sms_send_lock = true;
			win_time_out = setInterval("update_send_sms_loading()",1000);
			return true;
		}
		$.dialog.alert(rs.info);
		$("#sms_send_status").val('发送验证码');
	});
}
</script>
<!-- /if -->

<div class="main">
	<!-- include tpl=block/breadcrumb -->
	<div class="left"><!-- include tpl=block/usercp_nav --></div>
	<div class="right am-panel-group">
		<div class="am-panel am-panel-default">
			<div class="am-panel-hd">手机号修改</div>
			<div class="am-panel-bd">
				<form class="am-form am-form-horizontal" id="userinfo_mobile" method="post">
				<div class="am-form-group">
					<label for="pass" class="am-u-sm-2 am-form-label">会员密码</label>
					<div class="am-u-sm-10"><input type="password" name="pass" id="pass" /></div>
				</div>
				<!-- if $rs.mobile -->
				<div class="am-form-group">
					<label for="oldmobile" class="am-u-sm-2 am-form-label">原手机</label>
					<div class="am-u-sm-10"><input type="text" name="oldmobile" id="oldmobile" value="{$rs.mobile}" class="input" disabled /></div>
				</div>
				<!-- /if -->
				<div class="am-form-group">
					<label for="mobile" class="am-u-sm-2 am-form-label">名称</label>
					<div class="am-u-sm-{$sendsms ? 8 : 10}">
						<input type="text" name="mobile" id="mobile" value="" class="input" />
					</div>
					<!-- if $sendsms -->
					<div class="am-u-sm-2">
						<input type="button" value="发送验证码" onclick="send_sms()" class="am-btn am-btn-default" id="sms_send_status" />
					</div>
					<!-- /if -->
				</div>
				<!-- if $sendsms -->
				
				
				<div class="am-form-group">
					<label for="chkcode" class="am-u-sm-2 am-form-label"> 验证码</label>
					<div class="am-u-sm-10"><input type="text" name="chkcode" id="chkcode" /></div>
				</div>
				<!-- /if -->
				<div class="am-form-group">
					<label class="am-u-sm-2 am-form-label"></label>
					<div class="am-u-sm-10"><input type="submit" id="phpok_submit" value="提 交" class="am-btn am-btn-primary"></div>
				</div>
				</form>
			</div>
		</div>
		<div class="am-panel am-panel-default">
			<div class="am-panel-hd">友情说明</div>
			<div class="am-panel-bd">
				<ul>
					<li>手机号修改需要您提供会员密码认证</li>
					<li>请确填写的手机号是11位有效数字，暂不接受其他类型的手机号</li>
					<li>我们推荐您使用插件来实现手机号变更验证</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="clear"></div>
</div>

<!-- include tpl=foot -->